import React, { lazy } from "react";
import { WapHomeO, UserO, ShoppingCartO, OtherPay } from "@react-vant/icons";
import { Navigate } from 'react-router-dom'
const Car = lazy(() => import("../views/car"));
const Classify = lazy(() => import("../views/classify"));
const Detail = lazy(() => import("../views/detail"));
const Home = lazy(() => import("../views/home"));
const MainLayout = lazy(() => import("../views/mainLayout"));
const My = lazy(() => import("../views/my"));

export const CHILDREN_ROUTER_LIST = [
  {
    path: "/home",
    element: <Home></Home>,
    title: "首页",
    icon: <WapHomeO />,
  },
  {
    path: "/classify",
    element: <Classify></Classify>,
    title: "分类",
    icon: <OtherPay />,
  },
  {
    path: "/car",
    element: <Car></Car>,
    title: "购物车",
    icon: <ShoppingCartO />,
  },
  {
    path: "/my",
    element: <My></My>,
    title: "我的",
    icon: <UserO />,
  },
  {
    path: '/',
    element: <Navigate to="/home"></Navigate>,
    hidden: true
  }
];

export const ROUTER_lIST = [
  {
    path: "/",
    element: <MainLayout></MainLayout>,
    // 二级路由
    children: CHILDREN_ROUTER_LIST,
  },
  {
    path: "/list/:id",
    element: <Detail></Detail>,
  },
];
